all: exhaustive_table_generator main_noam create_authentication authenticate exhaustive_query \
	create_salty_authentication salty_authenticate create_rainbow_table crack_using_rainbow_table \
	text_export_rainbow_table main

clean:
	rm -f authenticate crack_using_rainbow_table create_authentication create_rainbow_table \
	create_salty_authentication exhaustive_query exhaustive_table_generator main main_noam \
	salty_authenticate text_export_rainbow_table \
	 *.o global/*.o misc/*.o exhaustive_search/*.o DEHT/*.o auth/*.o rainbow_table/*.o debug_tools/*.o


LIBRARIES := DEHT/deht.o global/misc.o global/md5.o global/sha1.o global/global_declarations.o \
		global/global_rainbow_table.o exhaustive_search/rule.o \
		exhaustive_search/dictionary.o global/global_auth.o
 

MAIN_NOAM_LIBS := main_noam.o $(LIBRARIES)

main_noam: $(MAIN_NOAM_LIBS)
	gcc $(MAIN_NOAM_LIBS) -lm -o main_noam
	
MAIN_LIBS := main.o $(LIBRARIES)

main: $(MAIN_LIBS)
	gcc $(MAIN_LIBS) -lm -o main


EXHAUSTIVE_TABLE_GENERATOR_LIBS := exhaustive_search/exhaustive_table_generator.o $(LIBRARIES)

exhaustive_table_generator: $(EXHAUSTIVE_TABLE_GENERATOR_LIBS)
	gcc $(EXHAUSTIVE_TABLE_GENERATOR_LIBS) -lm -o exhaustive_table_generator

CREATE_AUTHENTICATION_LIBS := auth/create_authentication.o $(LIBRARIES)

create_authentication: $(CREATE_AUTHENTICATION_LIBS)
	gcc $(CREATE_AUTHENTICATION_LIBS) -lm -o create_authentication

AUTHENTICATE_LIBS := auth/authenticate.o $(LIBRARIES)

authenticate: $(AUTHENTICATE_LIBS)
	gcc $(AUTHENTICATE_LIBS) -lm -o authenticate
	
EXHAUSTIVE_QUERY_LIBS := exhaustive_search/exhaustive_query.o $(LIBRARIES)

exhaustive_query: $(EXHAUSTIVE_QUERY_LIBS)
	gcc $(EXHAUSTIVE_QUERY_LIBS) -lm -o exhaustive_query

CREATE_SALTY_AUTHENTICATION_LIBS := auth/create_salty_authentication.o $(LIBRARIES)

create_salty_authentication: $(CREATE_SALTY_AUTHENTICATION_LIBS)
	gcc $(CREATE_SALTY_AUTHENTICATION_LIBS) -lm -o create_salty_authentication

SALTY_AUTHENTICATE_LIBS := auth/salty_authenticate.o $(LIBRARIES)

salty_authenticate: $(SALTY_AUTHENTICATE_LIBS)
	gcc $(SALTY_AUTHENTICATE_LIBS) -lm -o salty_authenticate

CREATE_RAINBOW_TABLE_LIBS := rainbow_table/create_rainbow_table.o $(LIBRARIES)

create_rainbow_table: $(CREATE_RAINBOW_TABLE_LIBS)
	gcc $(CREATE_RAINBOW_TABLE_LIBS) -lm -o create_rainbow_table


CRACK_USING_RAINBOW_TABLE_LIBS := rainbow_table/crack_using_rainbow_table.o $(LIBRARIES)
crack_using_rainbow_table: $(CRACK_USING_RAINBOW_TABLE_LIBS)
	gcc $(CRACK_USING_RAINBOW_TABLE_LIBS) -lm -o crack_using_rainbow_table
	
TEXT_EXPORT_RAINBOW_TABLE_LIBS := debug_tools/text_export_rainbow_table.o $(LIBRARIES)
text_export_rainbow_table: $(TEXT_EXPORT_RAINBOW_TABLE_LIBS)
	gcc $(TEXT_EXPORT_RAINBOW_TABLE_LIBS) -lm -o text_export_rainbow_table
        
%.o: %.c
	@echo $(notdir $<)
	@gcc -pedantic-errors -ansi -c -Wall -Werror -g $< -o $@
